package ronglei.day01.demo10Math;

/*
* java.util.Math 类是数字相关的工具类，提供了大量静态方法，完成与数学相关的操作
* publie static double abs（double num）,获取绝对值
* publie static double ceil(double num) ,向上取整
* public static double floor（double num），向下取整
* public static long round(doouble num) ,四舍五入
* */
public class Math01 {
    public static void main(String[] args) {
        //取绝对值
        System.out.println(Math.abs(3.14));//3.14
        System.out.println(Math.abs(-3.14));//3.14
        System.out.println("==================");
        //向上取整数
        System.out.println(Math.ceil(3.1));
        System.out.println("==================");
        //向下取整数
        System.out.println(Math.floor(3.3));
        System.out.println("==================");
        //四舍五入
        System.out.println(Math.round(3.566));
        //圆周率
        System.out.println(Math.PI);
    }
}
